Skip to content

util: guard callbackify against deleted length and name properties - #67754

Open
bunnysayzz wants to merge 1 commit into
nodejs:mainfrom
bunnysayzz:fix/callbackify-deleted-length-name-67745
Open

bunnysayzz wants to merge 1 commit into
nodejs:mainfrom
bunnysayzz:fix/callbackify-deleted-length-name-67745

Conversation

@bunnysayzz

Copy link
Copy Markdown

callbackify throws when the original function's length or name has been deleted. Object.getOwnPropertyDescriptors omits a deleted property, so reading descriptors.length.value throws. This guards both reads so a deleted property is just skipped, same as promisify already tolerates the manipulation.

Added a regression test in test/parallel/test-util-callbackify.js. It fails on the old code and passes with the fix. Verified the fixed function in a standalone harness against Node v24.22.1 plus node --check on both files; the full build was not run here, so CI still needs to run the suite.

Fixes: #67745

Fixes: nodejs#67745

Signed-off-by: bunnysayzz <stfuazzo@gmail.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

@addaleax addaleax added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 24, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 24, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.53%. Comparing base (a055d9f) to head (7610020).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #67754   +/-   ##
=======================================
  Coverage   90.52%   90.53%           
=======================================
  Files         803      803           
  Lines      285110   285112    +2     
  Branches    55037    55034    -3     
=======================================
+ Hits       258101   258125   +24     
+ Misses      17143    17138    -5     
+ Partials     9866     9849   -17     
Files with missing lines Coverage Δ
lib/util.js 100.00% <100.00%> (ø)

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread lib/util.js
Comment on lines -422 to +423
if (typeof descriptors.length.value === 'number') {
if (descriptors.length !== undefined &&
typeof descriptors.length.value === 'number') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, typeof descriptors.length?.value === 'number'?

@MikeMcC399 MikeMcC399 added resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. and removed author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Nov 25, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 25, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:automated-account needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

util: callbackify throws when function length or name property is deleted

7 participants